<!doctype html>
<!--
MD5calc in HTML and Javascript
version alpha 5

Written by @chenxiaoqino @HJin_me, 2011-10-19
Based on js MD5 Lib
Published under New BSD license: http://www.opensource.org/licenses/bsd-license.php
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*   Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>md5 password creator</title>
<style>
body {line-height:150%;}
div {padding:10px;}
span {background:rgb(255,255,190);}
div#resultbox span {font-family:monospace;}
#recreatebox {display:none;}
</style>
<script>
/*
 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
 * Digest Algorithm, as defined in RFC 1321.
 * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for more info.
 
 Modified and compressed by @chenxiaoqino
 */
function md5(a){function b(a){return d(c(e(a)))}function c(a){return g(h(f(a),a.length*8))}function d(a){var b="0123456789abcdef",c="",d;for(var e=0;e<a.length;e++)d=a.charCodeAt(e),c+=b.charAt(d>>>4&15)+b.charAt(d&15);return c}function e(a){var b="",c=-1,d,e;while(++c<a.length)d=a.charCodeAt(c),e=c+1<a.length?a.charCodeAt(c+1):0,55296<=d&&d<=56319&&56320<=e&&e<=57343&&(d=65536+((d&1023)<<10)+(e&1023),c++),d<=127?b+=String.fromCharCode(d):d<=2047?b+=String.fromCharCode(192|d>>>6&31,128|d&63):d<=65535?b+=String.fromCharCode(224|d>>>12&15,128|d>>>6&63,128|d&63):d<=2097151&&(b+=String.fromCharCode(240|d>>>18&7,128|d>>>12&63,128|d>>>6&63,128|d&63));return b}function f(a){var b=Array(a.length>>2);for(var c=0;c<b.length;c++)b[c]=0;for(var c=0;c<a.length*8;c+=8)b[c>>5]|=(a.charCodeAt(c/8)&255)<<c%32;return b}function g(a){var b="";for(var c=0;c<a.length*32;c+=8)b+=String.fromCharCode(a[c>>5]>>>c%32&255);return b}function h(a,b){a[b>>5]|=128<<b%32,a[(b+64>>>9<<4)+14]=b;var c=1732584193,d=-271733879,e=-1732584194,f=271733878;for(var g=0;g<a.length;g+=16){var h=c,i=d,o=e,p=f;c=j(c,d,e,f,a[g+0],7,-680876936),f=j(f,c,d,e,a[g+1],12,-389564586),e=j(e,f,c,d,a[g+2],17,606105819),d=j(d,e,f,c,a[g+3],22,-1044525330),c=j(c,d,e,f,a[g+4],7,-176418897),f=j(f,c,d,e,a[g+5],12,1200080426),e=j(e,f,c,d,a[g+6],17,-1473231341),d=j(d,e,f,c,a[g+7],22,-45705983),c=j(c,d,e,f,a[g+8],7,1770035416),f=j(f,c,d,e,a[g+9],12,-1958414417),e=j(e,f,c,d,a[g+10],17,-42063),d=j(d,e,f,c,a[g+11],22,-1990404162),c=j(c,d,e,f,a[g+12],7,1804603682),f=j(f,c,d,e,a[g+13],12,-40341101),e=j(e,f,c,d,a[g+14],17,-1502002290),d=j(d,e,f,c,a[g+15],22,1236535329),c=k(c,d,e,f,a[g+1],5,-165796510),f=k(f,c,d,e,a[g+6],9,-1069501632),e=k(e,f,c,d,a[g+11],14,643717713),d=k(d,e,f,c,a[g+0],20,-373897302),c=k(c,d,e,f,a[g+5],5,-701558691),f=k(f,c,d,e,a[g+10],9,38016083),e=k(e,f,c,d,a[g+15],14,-660478335),d=k(d,e,f,c,a[g+4],20,-405537848),c=k(c,d,e,f,a[g+9],5,568446438),f=k(f,c,d,e,a[g+14],9,-1019803690),e=k(e,f,c,d,a[g+3],14,-187363961),d=k(d,e,f,c,a[g+8],20,1163531501),c=k(c,d,e,f,a[g+13],5,-1444681467),f=k(f,c,d,e,a[g+2],9,-51403784),e=k(e,f,c,d,a[g+7],14,1735328473),d=k(d,e,f,c,a[g+12],20,-1926607734),c=l(c,d,e,f,a[g+5],4,-378558),f=l(f,c,d,e,a[g+8],11,-2022574463),e=l(e,f,c,d,a[g+11],16,1839030562),d=l(d,e,f,c,a[g+14],23,-35309556),c=l(c,d,e,f,a[g+1],4,-1530992060),f=l(f,c,d,e,a[g+4],11,1272893353),e=l(e,f,c,d,a[g+7],16,-155497632),d=l(d,e,f,c,a[g+10],23,-1094730640),c=l(c,d,e,f,a[g+13],4,681279174),f=l(f,c,d,e,a[g+0],11,-358537222),e=l(e,f,c,d,a[g+3],16,-722521979),d=l(d,e,f,c,a[g+6],23,76029189),c=l(c,d,e,f,a[g+9],4,-640364487),f=l(f,c,d,e,a[g+12],11,-421815835),e=l(e,f,c,d,a[g+15],16,530742520),d=l(d,e,f,c,a[g+2],23,-995338651),c=m(c,d,e,f,a[g+0],6,-198630844),f=m(f,c,d,e,a[g+7],10,1126891415),e=m(e,f,c,d,a[g+14],15,-1416354905),d=m(d,e,f,c,a[g+5],21,-57434055),c=m(c,d,e,f,a[g+12],6,1700485571),f=m(f,c,d,e,a[g+3],10,-1894986606),e=m(e,f,c,d,a[g+10],15,-1051523),d=m(d,e,f,c,a[g+1],21,-2054922799),c=m(c,d,e,f,a[g+8],6,1873313359),f=m(f,c,d,e,a[g+15],10,-30611744),e=m(e,f,c,d,a[g+6],15,-1560198380),d=m(d,e,f,c,a[g+13],21,1309151649),c=m(c,d,e,f,a[g+4],6,-145523070),f=m(f,c,d,e,a[g+11],10,-1120210379),e=m(e,f,c,d,a[g+2],15,718787259),d=m(d,e,f,c,a[g+9],21,-343485551),c=n(c,h),d=n(d,i),e=n(e,o),f=n(f,p)}return Array(c,d,e,f)}function i(a,b,c,d,e,f){return n(o(n(n(b,a),n(d,f)),e),c)}function j(a,b,c,d,e,f,g){return i(b&c|~b&d,a,b,e,f,g)}function k(a,b,c,d,e,f,g){return i(b&d|c&~d,a,b,e,f,g)}function l(a,b,c,d,e,f,g){return i(b^c^d,a,b,e,f,g)}function m(a,b,c,d,e,f,g){return i(c^(b|~d),a,b,e,f,g)}function n(a,b){var c=(a&65535)+(b&65535),d=(a>>16)+(b>>16)+(c>>16);return d<<16|c&65535}function o(a,b){return a<<b|a>>>32-b}return b(a);var p}
/*
a simple Hex string to Decimal Big Integer String function
Written by @chenxiaoqino
Published under New BSD license
*/
function hex2dec(a){var b=new Array,c,d="";a=d+a,l=a.length;var e=Math.ceil(l*1.21);for(i=0;i<e;i++)b[i]=0;for(i=0;i<l;i++){c=a.charCodeAt(i),c-=48,c>32&&(c-=32),c>9&&(c-=7);for(j=0;j<e;j++)b[j]*=16;b[0]+=c;for(j=0;j<e;j++)while(b[j]>=10)b[j]-=10,b[j+1]+=1}while(b[--e]==0);while(e>=0)d+=String.fromCharCode(b[e--]+48);return d==""&&(d="0"),d}
</script>
<script>
function $(id) {return document.getElementById(id);}
function createPwd(recreate)
{
	recreate = recreate || false;
	if(recreate) {
		var rawString = $("recreate").value || '';
	} else {
		var rawString = ($("srcbox1").value || '') 
					+ ($("srcbox2").value || '')
					+ (parseInt( $("version").value ) || 1);
		$("recreatebox").style.display = "block";
	}
	var str_md5 = md5(rawString);
	var str_decimal = hex2dec(str_md5);
	var length = parseInt($("cutselect").value) || str_decimal.length;

	var box = $("resultbox");
	box.innerHTML = "Source:" + '"' + rawString + '"';
	box.innerHTML += "<br />";
	box.innerHTML += "MD5: <span>" + str_md5.substr(0, length) + "</span>";
	box.innerHTML += "<br />";
	box.innerHTML += "Decimal: <span>" + str_decimal.substr(0, length) + "</span>";
	$("recreate").value = str_md5.substr(0, length);

	return false;
}
</script>
</head>
<body>
	<form action="#" onsubmit="return createPwd();">
	<div>
		<input type="text" id="srcbox1" value="主密码" />
		<input type="text" id="srcbox2" value="Service" />
	</div>
	<div>
		<input type="text" id="version" value="版本" />
		<select id="cutselect" onchange="cut();" >   
			<option value="0" >长度(option)</option>
	    	<option value="6" >6位</option>
	    	<option value="8" >8位</option>
	    	<option value="10" >10位</option>
	    	<option value="12" >12位</option>
	    	<option value="16" >16位</option>
	    	<option value="20" >20位</option>
	    </select>
	    <input type="submit" id="submit" value="MD5!"/>
	</div>
	</form>
	<div id="resultbox">
	</div>
	<div id="recreatebox">
		<form action="#" onsubmit="return createPwd(true);">
			<input type="hidden" id="recreate" value=""/>
			以当前MD5值为输入, 再算一次<input type="submit" value="&gt;"/>
		</form>
	</div>
</body>
</html>